package com.share.user.api;


import com.share.common.core.constant.SecurityConstants;
import com.share.common.core.constant.ServiceNameConstants;
import com.share.common.core.domain.R;
import com.share.user.api.domain.UpdateUserLogin;
import com.share.user.api.domain.UserInfo;
import com.share.user.api.factory.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient(contextId = "remoteUserInfoService", value = ServiceNameConstants.SHARE_USER, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserInfoService {

    @GetMapping("/userInfo/wxLogin/{code}")
    public R<UserInfo> wxLogin(@PathVariable("code") String code);

    @PutMapping("/userInfo/updateUserLogin")
    public R<Boolean> updateUserLogin(@RequestBody UpdateUserLogin updateUserLogin, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @GetMapping("/userInfo/getUserInfo/{userId}")
    public R<UserInfo> getUserInfo(@PathVariable("userId") Long userId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/userInfo/getUserCount")
    public R<Map<String, Object>> getUserCount();
}
